package com.tjetc.output;

import org.junit.jupiter.api.Test;

import java.io.*;

public class _4BufferedOutputStream {

    // 可以做图片和音视频的复制
    @Test
    public void testCopyFile() throws IOException {
        try (
                BufferedInputStream in =
                        new BufferedInputStream(new FileInputStream("/Users/gaoyongxiang/百度网盘/IDEA-Java/202507-java-se/chapter16/file/hello.txt"));
                BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream("/Users/gaoyongxiang/百度网盘/IDEA-Java/202507-java-se/chapter16/file/hello2.txt"));

        ) {
            byte[] bytes = new byte[1024];
            int len = 0;
            while ((len = in.read(bytes)) != -1) {
                out.write(bytes, 0, len);
            }
        }
    }

}
